package com.tsingteng.cosfun.ui.cosfun.presenter;

import com.tsingteng.cosfun.bean.BaseDataBean;
import com.tsingteng.cosfun.bean.LabelBean;
import com.tsingteng.cosfun.bean.ParagraphBean;
import com.tsingteng.cosfun.bean.WorkBean;
import com.tsingteng.cosfun.mvp.presenter.BasePresenter;
import com.tsingteng.cosfun.ui.cosfun.contract.PersonLabelContract;
import com.tsingteng.cosfun.ui.cosfun.contract.PersonWorkContract;
import com.tsingteng.cosfun.ui.cosfun.imodel.PersonLabelModel;
import com.tsingteng.cosfun.ui.cosfun.imodel.PersonWorkModel;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class PersonLabelPresenter extends BasePresenter<PersonLabelContract.IPersonLabelrView> implements PersonLabelContract.IPersonlabel {

    PersonLabelModel personModel = null;
    PersonLabelContract.IPersonLabelrView iPersonLabelrView = null;

    public PersonLabelPresenter(PersonLabelContract.IPersonLabelrView iPersonLabelrView) {
        this.personModel = new PersonLabelModel();
        this.iPersonLabelrView = iPersonLabelrView;
    }


    @Override
    public void getLabel(long user_id) {
        iPersonLabelrView.showLoading("");
        Callback<BaseDataBean<LabelBean>> workCallback = new Callback<BaseDataBean<LabelBean>>() {
            @Override
            public void onResponse(Call<BaseDataBean<LabelBean>> call, Response<BaseDataBean<LabelBean>> response) {
                iPersonLabelrView.hideLoading();
                iPersonLabelrView.getLabel(response.body().data);
            }

            @Override
            public void onFailure(Call<BaseDataBean<LabelBean>> call, Throwable t) {
                iPersonLabelrView.hideLoading();

            }
        };
        personModel.getLabel(user_id, workCallback);
    }
}
